<%@ Page Language="C#" MasterPageFile="~/MasterPages/Grey/Grey.Master" AutoEventWireup="true"
    CodeBehind="News.aspx.cs" Inherits="mmq.News" Title="<%$ Resources:GlobalResource,NewsPageTitle %>" Theme="Grey" %>

<%@ Register Src="UserControls/HeaderMenu.ascx" TagName="HeaderMenu" TagPrefix="uc1" %>
<asp:Content ID="Content2" ContentPlaceHolderID="Left" runat="server">
    <asp:SqlDataSource ID="sqlDSMainNews" runat="server" ConnectionString="<%$ ConnectionStrings:AC_DBConnectionString %>"
        SelectCommand="SELECT [ID], [Title], [Description] FROM [AC_PageContent] WHERE (([LanguageKey] = @LanguageKey) AND ([ContentKey] = @ContentKey) AND ([ID] = @ID))"
        UpdateCommand="UPDATE [AC_PageContent] SET [Title] = @Title, [Description] = @Description WHERE [ID] = @ID">
        <SelectParameters>
            <asp:Parameter DefaultValue="News" Name="ContentKey" Type="String" />
            <asp:ProfileParameter DefaultValue="en-US" Name="LanguageKey" PropertyName="PreferredCulture"
                Type="String" />
            <asp:QueryStringParameter DefaultValue="-1" Type="Int32" Name="ID" QueryStringField="QS_NewsID" />
        </SelectParameters>
        <UpdateParameters>
            <asp:Parameter Name="Title" Type="String" />
            <asp:Parameter Name="Description" Type="String" />
            <asp:ControlParameter ControlID="dv_News$ID" Name="ID" Type="Int32" PropertyName="Value" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <div style="float: right">
        <asp:LinkButton ID="hyLink_Edit" runat="server" 
            Text="<%$ Resources:GlobalResource,Edit %>" onclick="hyLink_Edit_Click" />
    </div>
    <asp:DetailsView DataSourceID="sqlDSMainNews" ID="dv_News" runat="server" AutoGenerateRows="false"
        BorderWidth="0" DataKeyNames="ID" AutoGenerateEditButton="false" 
        onitemupdated="dv_News_ItemUpdated">
        <Fields>
            <asp:TemplateField>
                <ItemTemplate>
                    <h3>
                        <%# DataBinder.Eval(Container.DataItem, "Title")%>
                    </h3>
                    <p>
                        <%# DataBinder.Eval(Container.DataItem, "Description")%>
                    </p>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:HiddenField ID="ID" runat="server" Value='<%# Bind("ID") %>' />
                    <p>
                        <asp:TextBox ID="txtTitle" runat="server" Columns="50" Text='<%# Bind("Title") %>' />
                    </p>
                    <p>
                        <htmlEditor:HtmlEditor ID="txtDescription" runat="server" Text='<%# Bind("Description") %>' />
                    </p>
                </EditItemTemplate>
            </asp:TemplateField>
        </Fields>
    </asp:DetailsView>
</asp:Content>
<asp:Content ContentPlaceHolderID="navigation" runat="server">
    <uc1:HeaderMenu ID="HeaderMenu1" runat="server" SelectedTab="Home" />
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="Right" runat="server">
    <h4>
        <asp:Literal ID="literal1" runat="server" Text="<%$ Resources:GlobalResource,NewsList %>" />
    </h4>
    <asp:Repeater DataSourceID="SqlDSNews" runat="server" ID="rptr_News">
        <HeaderTemplate>
            <ul class="block">
        </HeaderTemplate>
        <ItemTemplate>
            <li><a href='<%# "News.aspx?QS_NewsID="+DataBinder.Eval(Container.DataItem, "ID") %>'>
                <span>
                    <%# DataBinder.Eval(Container.DataItem, "Title")%>
                </span></a></li>
        </ItemTemplate>
        <FooterTemplate>
            </ul>
        </FooterTemplate>
    </asp:Repeater>
    <asp:SqlDataSource ID="SqlDSNews" runat="server" ConnectionString="<%$ ConnectionStrings:AC_DBConnectionString %>"
        SelectCommand="SELECT [ID], [Title], [Description] FROM [AC_PageContent] WHERE (([ContentKey] = @ContentKey) AND ([LanguageKey] = @LanguageKey)) ORDER BY [ID] DESC">
        <SelectParameters>
            <asp:Parameter DefaultValue="News" Name="ContentKey" Type="String" />
            <asp:ProfileParameter DefaultValue="en-US" Name="LanguageKey" PropertyName="PreferredCulture"
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
</asp:Content>
<asp:Content ContentPlaceHolderID="BottomLeft" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="BottomRight" runat="server">
</asp:Content>
